package sporteam.web.server;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONException;
import org.json.JSONObject;


public class Connection extends HttpServlet
{
	private static final Logger MyLog = Logger.getLogger(SendLog.class.getName());
    private static final String SendLogURL = "http://sporteamtest.appspot.com/SendLog";
	private static final long serialVersionUID = 1L;

	@Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException 
    {
		resp.setContentType("application/json");
		JSONObject responseJson = new JSONObject();
		
		try 
		{
			responseJson.put("connection_status", "c");
		} catch (JSONException e)
		{
			e.printStackTrace();
		}
		
		// write json to HTTP response
		resp.getWriter().write(responseJson.toString());
		resp.getWriter().flush();
    }
	
	@Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException 
    {
		resp.setContentType("application/json");
		JSONObject responseJson = new JSONObject();
		
		try 
		{
			responseJson.put("connection_status", "c");
		} catch (JSONException e)
		{
			e.printStackTrace();
		}
		
		// write json to HTTP response
		resp.getWriter().write(responseJson.toString());
		resp.getWriter().flush();
    }
}